<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <title>商品分类列表页面</title>
</head>
<?php 
include_once("inc.php");
include_once("base.php");
$tb_name = "category";
$where_sql = "pid=1";
$page = $_REQUEST["page"]?$_REQUEST["page"]:1;
$list = db_get_page("select * from $tb_name where $where_sql order by id asc", $page,10);
include_once ROOT_PATH."/common/page.php";
?>
<body>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" rowspan="2" valign="top" bgcolor="#FFFFFF"></td>
			<td valign="top">
				<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0">
					<tr bgcolor="#FFFFFF">
						<td height="31">
							<div class="title">
								<a href="<?php echo $tb_name;?>_edit.php?pid=<?php echo $_REQUEST["pid"]; ?>">添加</a>
							</div>
						</td>
					</tr>
				</table>
			</td>
			<td width="16" rowspan="2" bgcolor="#FFFFFF"></td>
		</tr>
		<tr>
			<td valign="top" bgcolor="#F7F8F9">
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td colspan="4" height="10"></td>
					</tr>
					<tr>
						<td width="1%">&nbsp;</td>
						<td width="96%">
							<table width="100%">
								<td colspan="2">
									<table width="100%"  class="cont tr_color">
										<tr>
											<th>名称</th>
											<th width="120">操作</th>
										</tr>
										<?php
										foreach($list["data"] as $row) {?>
										<tr align="center" class="d">
											<td><?php echo $row['title'];?></td>
											<td align="center">
												<a href="<?php echo $tb_name;?>_edit.php?id=<?php echo $row['id'];?><?php echo $condition;?>">编辑</a>　
												<a href="?id=<?php echo $row['id'];?>&act=del<?php echo $condition;?>&page=<?php echo $page;?>" onclick='return confirm("真的要删除?不可恢复!");'>删除</a>
											</td>
										</tr>
										<?php } ?>
									</table>
									<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
										<tr>
											<td align="center"><?php echo $page_show;?></td>
										</tr>
									</table>
								</td>
								<!-- </tr> -->
							</table>   
						</td>
						<td width="1%">&nbsp;</td>
					</tr>
					<tr><td height="20"></td></tr>
				</table>
			</td>
		</tr>
	</table>
<?php
	if ($_REQUEST["act"]=="del") {
		delcategory($tb_name,$_REQUEST["id"]);
		urlMsg("21操作成功", $tb_name."_list.php?".$condition);
	}
?>
</body>
</html>